PROT_READ|PROT_WRITE, pfn);
if (mem == NULL) {
ERROR("cannot map page");
- return -1;
+ return -1;
}
if (!read_exact(io_fd, mem, PAGE_SIZE)) {
ERROR("Error when reading from state file (5)");
+ munmap(mem, PAGE_SIZE);
return -1;
}
munmap(mem, PAGE_SIZE);
}
if (!read_exact(io_fd, shared_info, PAGE_SIZE)) {
ERROR("Error when reading shared_info page");
+ munmap(shared_info, PAGE_SIZE);
goto out;
}
/* Uncanonicalise the suspend-record frame number and poke resume rec. */
start_info = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
PROT_READ | PROT_WRITE, gmfn);
+ if (start_info == NULL) {
+ ERROR("cannot map start_info page");
+ goto out;
+ }
start_info->nr_pages = p2m_size;
start_info->shared_info = shared_info_frame << PAGE_SHIFT;
start_info->flags = 0;
if (!write_exact(io_fd, &N, sizeof(N))) {
ERROR("write: max_pfn");
+ munmap(mem, PAGE_SIZE);
goto out;
}
if (write(io_fd, mem, PAGE_SIZE) != PAGE_SIZE) {
ERROR("Error when writing to state file (5)");
+ munmap(mem, PAGE_SIZE);
goto out;
}
munmap(mem, PAGE_SIZE);
}
if (write(io_fd, mem, PAGE_SIZE) != PAGE_SIZE) {
ERROR("Error when writing privreg to state file (5)");
+ munmap(mem, PAGE_SIZE);
goto out;
}
munmap(mem, PAGE_SIZE);